//
//  EveryDayResigterViewController.m
//  wtshoppingcite
//
//  Created by TW on 14-10-24.
//  Copyright (c) 2014年 TW. All rights reserved.
//

#import "EveryDayResigterViewController.h"
#import "ScoreRuleViewController.h"
#import "AppDelegate.h"

@interface EveryDayResigterViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    UITableView *everyDayTableView;
}
@end

@implementation EveryDayResigterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self setTitleView:@"每日签到"];
    
    
    UIView *everyDayView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 40, 30)];
    [self.view addSubview:everyDayView];
    everyDayView.userInteractionEnabled = YES;
    
    UIButton *everyDayButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 30)];
    [everyDayButton setImage:[UIImage imageNamed:@"add_weichat"] forState:UIControlStateNormal];
    [everyDayButton addTarget:self action:@selector(everyDayAction) forControlEvents:UIControlEventTouchUpInside];
    [everyDayButton setTitleColor:MAIN_BLACK_COLOR forState:UIControlStateNormal];
    [everyDayView addSubview:everyDayButton];
    
    UIBarButtonItem *rightButtonItem = [[UIBarButtonItem alloc]initWithCustomView:everyDayView];
    self.navigationItem.rightBarButtonItem = rightButtonItem;
    
    
    everyDayTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 120) style:UITableViewStylePlain];
    everyDayTableView.delegate = self;
    everyDayTableView.dataSource = self;
    everyDayTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    everyDayTableView.scrollEnabled = NO;
    
    [self.view addSubview:everyDayTableView];
    
    // Do any additional setup after loading the view.
}

-(void)everyDayAction{
    NSLog(@"");
    ScoreRuleViewController *scoreRuleVC = [[ScoreRuleViewController alloc]init];
    [self.navigationController pushViewController:scoreRuleVC animated:YES];
}


#pragma mark uitableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"everydayCellIndentitfer"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"everydayCellIndentitfer"];
        cell.userInteractionEnabled = YES;
    }
    
    UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 10, 100, 20)];
    titlelabel.font = [UIFont systemFontOfSize:12.0f];
    titlelabel.text = @"您已连续签到一天";
    [cell.contentView addSubview:titlelabel];
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(titlelabel.left, titlelabel.bottom, 30, 20)];
    label.font = [UIFont systemFontOfSize:12.0f];
    label.text = @"积分:";
    [cell.contentView addSubview:label];
    
    UILabel *countNumlabel = [[UILabel alloc]initWithFrame:CGRectMake(label.right, label.top, 30, 20)];
    countNumlabel.textAlignment = NSTextAlignmentCenter;
    countNumlabel.font = [UIFont systemFontOfSize:12.0f];
    countNumlabel.text = self.otherModel.score ;
    [cell.contentView addSubview:countNumlabel];
    
    UILabel *scoreLabel = [[UILabel alloc]initWithFrame:CGRectMake(countNumlabel.right - 5, countNumlabel.top, 20, 20)];
    scoreLabel.font = [UIFont systemFontOfSize:12.0f];
    scoreLabel.text = @"分";
    [cell.contentView addSubview:scoreLabel];
    
    
    UIButton *continueButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    continueButton.frame =  CGRectMake(scoreLabel.right + 80 ,titlelabel.bottom - 15, 120, 30);
    [continueButton setTitle:@"明日签到+7" forState:UIControlStateNormal];
    [continueButton setBackgroundColor:MAIN_GRAY_COLOR];
    [cell.contentView addSubview:continueButton];
    
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 100;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    ;
}


- (void)viewWillDisappear:(BOOL)animated
{
    
    [super viewWillDisappear:animated];
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
